#ifndef QVBOX_H
#define QVBOX_H

#include <QMainWindow>
#include "myserialport.h"
#include "setting.h"
#include <QLabel>
#include <QTimer>
#include <QAction>
#include <QActionGroup>
#include <QThread>

namespace Ui {
class QVBOX;
}

class QVBOX : public QMainWindow
{
    Q_OBJECT

public:
    explicit QVBOX(QWidget *parent = 0);
    ~QVBOX();
    void closeEvent(QCloseEvent *e);

protected:
    bool eventFilter(QObject *target, QEvent *event);//事件过滤器

private:
    Ui::QVBOX *ui;
    QThread *m_pSpThread;
    MySerialPort *mySerialPort;
    QLabel *m_QLableTxRx;
    QString m_SaveFilePath;
    QString m_SaveFileName;
    QStringList m_SendHistoryList;
    qint32 m_SendHistoryGetIndex;
    void updateStatusBarTxRx();
    QTimer *m_FixSendTimer;
    QMenu *m_MenuFile;
    QMenu *m_MenuSetting;
    QMenu *m_MenuEncoding;
    QActionGroup *m_ActGrpEncoding;
    QAction *m_ActNew;
    QAction *m_ActSave;
    QAction *m_ActEncodingUtf8;
    QAction *m_ActEncodingGbk;
    setting *m_setting;

    void createActions();
    void createMenus();

private:
    void slotBtnSendData();


public slots:
    void slotSerialPortRecvShow(QString data);
    void slotBtnOpenCloseClick();
};

#endif // QVBOX_H
